package io.xccit.clients;

import io.xccit.pojo.param.ProductCollectParam;
import io.xccit.pojo.param.ProductIDParam;
import io.xccit.pojo.product.Product;
import io.xccit.result.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author CH_ywx
 * @date 2023-09-12
 * @description 商品远程调用
 */
@FeignClient("product-service")
public interface IProductClients {

    /**
     * 搜索服务调用,进行商品同步及删除
     * @return
     */
    @GetMapping("/product/list")
    List<Product> productList();

    @PostMapping("/product/collect/list")
    public AjaxResult getProductByIds(@RequestBody ProductCollectParam productCollectParam);

    /**
     * 根据商品ID获取商品详情
     * @param productIDParam
     * @return
     */
    @PostMapping("/product/cart/detail")
    public Product getDetail(@RequestBody ProductIDParam productIDParam);

    /**
     * 购物车获取商品信息远程调用接口
     * @param productCollectParam
     * @return
     */
    @PostMapping("/product/cart/list")
    public List<Product> selectCartProductByIds(@RequestBody ProductCollectParam productCollectParam);
}
